package com.czk.model.menmto;

/**
 * @Author:ChenZhangKun
 * @Date: 2020/5/14 20:18
 */
public class Client {
    public static void main(String[] args) {
        Originator originator=new Originator();
        CareTaker careTaker=new CareTaker();
        originator.setState("状态一");
        careTaker.add(originator.getMemento());
        // 状态二
        originator.setState("状态二");
        careTaker.add(originator.getMemento());
        // 恢复状态一
        System.out.println("当前的状态是"+originator.getState());
        originator.getStateFromMemento(careTaker.get(0));
        System.out.println("恢复后的状态是"+originator.getState());
    }
}
